# coding:utf-8
import datetime
import logging
import os
from logging.handlers import TimedRotatingFileHandler

if __name__ == '__main__':
    isExists = os.path.exists("wcc")
    if not isExists:
        os.makedirs("wcc")
    else:
        print("wcc" + "目录已经存在")


    logger = logging.getLogger('simple_example')
    logger.setLevel(logging.INFO)
    ch = TimedRotatingFileHandler("wcc/{}.log".format(datetime.datetime.now().strftime('%Y-%m-%d')), when='D', encoding="utf-8")
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)

    logger.info('info message')
